

fang = [0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x02,0x00,0x06,0x02,0x00,0x02,0x02,0x00,0x7F,
0xF7,0xFE,0x18,0x04,0x18,0x18,0x04,0x18,0x18,0x04,0x18,0x1F,0xCC,0x10,0x18,0x4C,
0x10,0x18,0x6C,0x10,0x18,0x74,0x10,0x18,0x74,0x30,0x10,0x62,0x20,0x10,0x62,0x20,
0x10,0x63,0x60,0x10,0x41,0x40,0x10,0x41,0xC0,0x30,0x41,0xC0,0x20,0x43,0x60,0x60,
0x46,0x30,0x4C,0xCC,0x18,0x47,0xB0,0x06]

# MicroPython Test Code

from machine import I2C, Pin
from drivers.ssd1306 import SSD1306_I2C
import framebuf

oled = None

def test_new_array():
	char = bytearray(fang)
	buffer = framebuf.FrameBuffer(char, 24, 24, framebuf.MONO_HLSB) # 注意不是 MONO_VLSB
	oled.fill(0)
	oled.blit(buffer, 20, 20)
	oled.show()


def main():
	global oled

	i2c = I2C(0, scl=Pin(18), sda=Pin(19))
	slave_list = i2c.scan()

	if slave_list:
		print('slave id: {}'.format(slave_list[0]))
		oled = SSD1306_I2C(128, 64, i2c)

		test_new_array()

if __name__ == "__main__":
	main()
